<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>分享列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../module/inventory/css/admin/index.css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../module/inventory/scripts/yui/yahoo-dom-event/yahoo-dom-event.js" ></script>
<script type="text/javascript" src="../module/inventory/scripts/yui/dragdrop/dragdrop-min.js" ></script>
<script type="text/javascript" src="../module/inventory/scripts/yui/calendar/calendar-min.js"></script>
<script type="text/javascript" src="../module/inventory/scripts/index.js"></script>
<script type="text/javascript">
    $(function(){
        /* 全选 */
         $('.checkall').click(function(){
            var _self = this;
            $('.checkitem').each(function(){
                if (!this.disabled)
                {
                    $(this).attr('checked', _self.checked);
                }
            });
            $('.checkall').attr('checked', this.checked);
        });
    });
    
  //展开标签信息
    function showOrHideTagInfo(snsId){
        var flag = false;
        if(flag){
        	return;
        }
    	var ctag = $('#show_pic_tags_'+snsId);
    	var tclass = ctag.attr('tagsta');
    	flag = true;
    	if(tclass=='show'){
    		$.get('<{$config.weburl}>/admin/module.php?m=sns&s=sns.php&act=get_pic_tags&sns_id='+snsId,function(data){
    			ctag.parent().parent().after(data);
    			ctag.attr('tagsta','hide');
    			ctag.attr('src','../image/admin/hidechild.png');
    			flag = false;
    		});
    	}else if(tclass=='hide'){
    		$('#tagH_'+snsId).remove();
    		$('.tagC_'+snsId).remove();
    		ctag.attr('tagsta','show');
    		ctag.attr('src','../image/admin/addchildboard.png');
    	}
    }
  //保存标题
  	function saveTitle(snsId){
  		if(snsId>0){
  			var title = $('#title_'+snsId).val();
  			$.post('<{$config.weburl}>/admin/module.php?m=sns&s=sns.php',{"snsid":snsId,"title":title,"act":"saveTitle"},function(s){});
  		}
  	}
    //保存评论内容
    function saveComment(comId){
        if(comId>0){
            var comment = $('#comment_'+comId).val();
            $.post('<{$config.weburl}>/admin/module.php?m=sns&s=sns.php',{"id":comId,"comment":comment,"act":"saveComment"},function(s){});
        }
    }
</script>
</head>
<body>
<div class="container">
	<{if $smarty.get.act=='getFavoriteMember'}>
		<div class="flow">
	        <div class="itemtitle">
	            <h3>点赞会员</h3>
	            <ul>
                    <li><a href="?m=sns&s=sns.php"><span>分享列表</span></a></li>
                </ul>
	        </div>
	    </div>
	    
	    <div class="h35"></div>

	    <table class="table product">
	        <tbody>
	            <tr class="header">
	                <th width="50">用户ID</th>
	                <th width="100">用户名称</th>
	                <th width="100">用户头像</th>
	                <th width="50">性别</th>
	                <th width="100">手机</th>
	                <th width="100">邮箱</th>
	                <th width="50">注册时间</th>
	            </tr>
	            <{foreach item=list from=$de.favoriteMembers}>
	            <tr>
	                <td><{$list.userid}></td>
	                <td><{$list.username}></td>
	                <td width="80">
	                	<img width="60" height="60" class="img" src="<{$list.logo}>" />
	                </td>
	                <td><{if '1'==$list.sex}>男<{else}>女<{/if}></td>
	                <td><{$list.mobile}></td>
	                <td><{$list.email}></td>
	                <td><{$list.regtime}></td>
	            </tr>
	            <{foreachelse}>
	            <tr>
	                <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
	            </tr>
	            <{/foreach}>
	        </tbody>
	        <tfoot>
	            <tr>
	                <td colspan="99"><div class="page"><{$de.page}></div><{if $countpro}>共有<{$countpro}>条记录<{/if}></td>
	            </tr>
	        </tfoot>
	    </table>
	<{elseif $smarty.get.act=='getCommentsList'}>
	   <div class="flow">
            <div class="itemtitle">
                <h3>评论列表</h3>
                <ul>
                    <li><a href="?m=sns&s=sns.php"><span>分享列表</span></a></li>
                </ul>
            </div>
        </div>
        
        <div class="h35"></div>
        
        <form action="" method="get">
        <input type="hidden" name="m" value="sns">
        <input type="hidden" name="s" value="sns.php">
        <input type="hidden" name="snsid" value="<{$smarty.get.snsid}>">
        <input type="hidden" name="act" value="getCommentsList">
            <tbody>
                <tr>
                    <td width="20">状态:</td>
                    <td width="30">
                        <select name="status">
                            <option value="">有效</option>
                            <option value="0" <{if '0'==$smarty.get.status}>selected<{/if}>>已禁用</option>
                            <option value="1" <{if '1'==$smarty.get.status}>selected<{/if}>>正常显示</option>
                        </select>
                    </td>
                    <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                    <td><input id="search" type="image" src="<{$config.weburl}>/image/admin/search.gif" /></td>
                </tr>
                
            </tbody>
        </table>
        </form>

        <form action="" method="get">
        <input type="hidden" name="m" value="sns">
        <input type="hidden" name="s" value="sns.php">
        <input type="hidden" name="sns_id" value="<{$smarty.get.snsid}>">
        <table class="table product">
            <tbody>
                <tr class="header">
                    <th width="20"><input type="checkbox" class="checkall" ></th>
                    <th width="50">楼层</th>
                    <th colspan="2">用户</th>
                    <th width="100">评论内容</th>
                    <th width="50">评论时间</th>
                    <th width="50">状态</th>
                </tr>
                <{foreach item=list from=$de.comment_list}>
                <tr>
                    <td><input type="checkbox" value="<{$list.id}>" class="checkitem" name="chksnscomments[]"></td>
                    <td><{$list.floor}></td>
                    <td class="al" width="80" valign="top"><img class="img" alt="<{$list.name}>" src="<{if !$list.logo}>/image/logo.png<{else}><{$list.logo}>/92<{/if}>" width="80" /></td>
                    <td class="al" width="50">
                        <p>昵称：<a href="?m=sns&s=sns.php&act=getCommentsList&snsid=<{$smarty.get.snsid}>&member_id=<{$list.userid}>"><{$list.name}></a></p>
                        <p>动作：<{if $list.aplay_name}>回复 <{$list.aplay_name}><{else}>评论分享<{/if}></p>
                    </td>
                    <td><textarea id="comment_<{$list.id}>" style="height:50px;" onblur="javascript:saveComment(<{$list.id}>);"><{$list.content}></textarea></td>
                    <td><{$list.create_time}></td>
                    <td>
                        <{if '0'==$list.status}>禁用<{/if}>
                        <{if '1'==$list.status}>显示<{/if}>
                    </td>
                </tr>
                <{foreachelse}>
                <tr>
                    <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
                </tr>
                <{/foreach}>
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="99">
                        状态设置:
                        <select name="set_status">
                            <option value="">--请选择--</option>
                            <option value="-1" >删除</option>
                            <option value="0" >禁用</option>
                            <option value="1" >显示</option>
                        </select>
                        <input type="hidden" name="act" value="comment_op" />
                        <input type="submit" value="提交" />
                        <div class="page"><span style="float:left;line-height: 20px;"><{if $countpro}>共有<{$countpro}>条记录<{/if}></span><{$de.page}></div>
                    </td>
                </tr>
            </tfoot>
        </table>
        </form>
	<{else}>
	    <div class="flow">
	        <div class="itemtitle">
	            <h3>分享列表</h3>
	        </div>
	    </div>
	    
	    <div class="h35"></div>
	    
	    <form action="" method="get">
	    <input type="hidden" name="m" value="sns">
	    <input type="hidden" name="s" value="sns.php">
	    <table class="select_table">
	        <tbody>
	            <tr>
	                <td width="60">分享ID:</td>
                    <td width="100"><input id="sns_id" type="text" name="sns_id" class="w100" value="<{$smarty.get.sns_id}>" /></td>
	                <td width="60">分享时间:</td>
	                <td class="yui-skin-sam" width="150">
	                	<input style="width:70px;" id="sdate" name="sdate" type="text" size="12" value="<{$smarty.get.sdate}>" onfocus="lockinput(this)" autocomplete="off"/>
	                	<input style="width:70px;" id="edate" name="edate" type="text" size="12" value="<{$smarty.get.edate}>" onfocus="lockinput(this)" autocomplete="off"/>
	            		<div id="calContainer" style="display:none; position:absolute;"></div>
            		</td>
	                <td width="60">会员名称:</td>
	                <td width="100"><input id="username" type="text" name="username" class="w100" value="<{$smarty.get.username}>" /></td>
	                <td width="20">标签:</td>
	                <td width="100"><input id="tagname" type="text" name="tagname" class="w100" value="<{$smarty.get.tagname}>" /></td>
	                <td width="20">品牌:</td>
	                <td width="100">
	                	<input type="hidden" name="brandid" class="brandid" value="<{$smarty.get.brandid}>"/>
	                	<input style="width:150px;" type='text' name='brand' class='brands' value="<{$smarty.get.brand}>" placeholder='输入搜索词' autocomplete="off"/>
	            		<ul class="brandlist" style="display:none;position:absolute;background-color:#fff;border: 1px solid rgb(207, 201, 201);width: 150px;">
	        			</ul>
	                </td>
                </tr>
                <tr>
	                <td width="20">状态:</td>
	                <td width="30">
	                	<select name="status">
	                		<option value="">有效</option>
	                		<option value="-1" <{if '-1'==$smarty.get.status}>selected<{/if}>>已删除</option>
	                		<option value="0" <{if '0'==$smarty.get.status}>selected<{/if}>>已禁用</option>
	                		<option value="1" <{if '1'==$smarty.get.status}>selected<{/if}>>正常显示</option>
	                		<option value="2" <{if '2'==$smarty.get.status}>selected<{/if}>>推荐显示</option>
	                	</select>
	                </td>
	                <input type="hidden" id="order" name="" value="" />
	                <td><input id="search" type="image" src="<{$config.weburl}>/image/admin/search.gif" /></td>
	            </tr>
	            
	        </tbody>
	    </table>
	    </form>
	
		<form action="" name="snsform" method="get">
		<input type="hidden" name="m" value="sns">
	    <input type="hidden" name="s" value="sns.php">
	    <table class="table product">
	        <tbody>
	            <tr class="header">
	                <th width="20"><input type="checkbox" class="checkall" ></th>
	                <th width="30"></th>
	                <th width="50">分享ID</th>
	                <th width="100">分享图片</th>
	                <th width="100">分享标题</th>
	                <th width="150">会员信息</th>
	                <th width="50"><a href="javascript:doorder('order','<{if $smarty.get.order==desc}>asc<{else}>desc<{/if}>');">点赞数</a></th>
	                <th width="50"><a href="javascript:doorder('commentsorder','<{if $smarty.get.commentsorder==desc}>asc<{else}>desc<{/if}>');">评论数</a></th>
	                <th width="50"><a href="javascript:doorder('timeorder','<{if $smarty.get.timeorder==desc}>asc<{else}>desc<{/if}>');">分享时间</a></th>
	                <th width="100">状态</th>
	            </tr>
	            <{foreach item=list from=$de.list}>
	            <tr>
	                <td><input type="checkbox" value="<{$list.id}>" class="checkitem" name="chksns[]"></td>
	                <td><img id="show_pic_tags_<{$list.id}>" tagsta="show" style="cursor:pointer;width:14px;height:14px;" onclick="javascript:showOrHideTagInfo(<{$list.id}>);" src="../image/admin/addchildboard.png" /></td>
	                <td><{$list.id}></td>
	                <td>
	                	<img class="img" src="<{if $list.pic!=''}><{$img_url_pre}><{$list.pic}>/80<{else}>../image/admin/no_picture.jpg<{/if}>" onerror="this.src='../image/admin/sns_img_fail_min.jpg'" width="80" height="80" <{if $list.pic!=''}>onmouseover="javascript:showOriginImg('<{$img_url_pre}><{$list.pic}>');" onmouseout="javascript:hideOriginImg();"<{/if}>/>
                	</td>
	                <td><textarea id="title_<{$list.id}>" style="resize:none;" onblur="javascript:saveTitle(<{$list.id}>);"><{$list.title}></textarea></td>
	                <td width="80">
	                	<img width="40" height="40" class="img" src="<{$list.member_photo}>" />
						<span>
							<p>会员ID：<{$list.member_id}></p>
		                	<p>会员名称：<{if ''==$list.member_name}>暂无<{else}><{$list.member_name}><{/if}></p>
						</span>
	                </td>
	                <td><a style="color:blue;text-decoration:underline;" href="?m=sns&s=sns.php&act=getFavoriteMember&snsid=<{$list.id}>"><{$list.favoriteNum}></a></td>
	                <td><a style="color:blue;text-decoration:underline;" href="?m=sns&s=sns.php&act=getCommentsList&snsid=<{$list.id}>"><{$list.comments_num}></a></td>
	                <td><{$list.create_time}></td>
	                <td>
	                <{if '-1'==$list.status}>已删除<{/if}>
	                <{if '0'==$list.status}>违规禁用<{/if}>
	                <{if '1'==$list.status}>正常显示<{/if}>
	                <{if '2'==$list.status}>推荐显示<{/if}>
	                </td>
	            </tr>
	            <{foreachelse}>
	            <tr>
	                <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
	            </tr>
	            <{/foreach}>
	        </tbody>
	        <tfoot>
	            <tr>
	                <td colspan="99">
	                	状态设置:
	                	<select name="set_status">
	                		<option value="">--请选择--</option>
	                		<option value="-1" >删除</option>
	                		<option value="0" >禁用</option>
	                		<option value="1" >正常</option>
	                		<option value="2" >推荐</option>
	                	</select>
		                <input type="hidden" name="act" value="op" />
	                    <input type="submit" value="提交" />
	                	<div class="page"><span style="float:left;line-height: 20px;"><{if $countpro}>共有<{$countpro}>条记录<{/if}></span><{$de.page}></div>
	                </td>
	            </tr>
	        </tfoot>
	    </table>
	    </form>
    <{/if}>
</div>
<div id="snsImgDetail" align="center" style="position:fixed;top:30px;left:30%;display:none;"><img width="560" height="560" src="" onerror="this.src='../image/admin/sns_img_fail_min.jpg'" /></div>
</body>
<script>
//排序
function doorder(key,value){
	var order = $('#order');
	order.attr('name',key);
	order.attr('value',value);
	
	$('#search').trigger('click');
}
//展示分享图片原图
function showOriginImg(src){
	var snsImgDetail = $("#snsImgDetail");
	snsImgDetail.find('img').attr('src',src+"/560"); 
	snsImgDetail.show();
}
//隐藏分享图片原图
function hideOriginImg(){
	$("#snsImgDetail").hide();
}

$(function(){
	//默认待选品牌
	$('.brands').bind('click',function(e){
			$.get('<{$config.weburl}>/admin/module.php?m=activity&s=activity.php&operation=getbrand&brandname=',function(data){
				$('.brandlist').show();
				$('.brandlist').html(""+data);
			});
	});
	//直接搜品牌
	$('.brands').bind('input',function(e){
		var value=$(this).val();
		if(value==''){
			$('.brandlist').hide();
			return ;
		}
		else{
			$.get("<{$config.weburl}>/admin/module.php?m=activity&s=activity.php&operation=getbrand&brandname="+value,function(data){
				$('.brandlist').show();
				$('.brandlist').html(""+data);
			});
		}
	});
	$('body').bind('click',function(e){
		$('.brandlist').hide();
	});
	$('.brandlist').delegate('li','click',function(){
		var _this=$(this);
		var brandName=_this.text();
			var brandId=_this.attr('bid');
			$('.brands').val(brandName);
			$('.brandid').val(brandId);
			$('.brandlist').hide();
	});
});
</script>
</html>